package com.gxuwz.zlc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gxuwz.zlc.entity.Audition;
import com.gxuwz.zlc.mapper.AuditionMapper;
import com.gxuwz.zlc.service.AuditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AuditionServiceImpl implements AuditionService {

    @Autowired
    private AuditionMapper auditionMapper;

    @Override
    public List<Audition> findAudition() {
        return auditionMapper.selectList(null);
    }

    @Override
    public Audition findAuditionById(Integer auditionId) {
        return auditionMapper.selectById(auditionId);
    }

    @Override
    public void addAudition(Audition audition) {
        auditionMapper.insert(audition);
    }

    @Override
    public void updateAudition(Audition audition) {
        auditionMapper.updateById(audition);
    }

    @Override
    public void deleteAudition(Integer auditionId) {
        auditionMapper.deleteById(auditionId);
    }

    @Override
    public void updateAuditionByStuId(Audition audition, String stuId) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("stu_id",stuId);
        auditionMapper.update(audition,wrapper);
    }
}
